// 跳转-判断tuoken是否存在
function urlClick(url = '', nav = 0, type = true) {
	if (!url) {
		return
	}
	if (type) {
		let token = uni.getStorageSync('token')
		if (token) {
			//存在
			Tiao(url, nav)
		} else {
			//不存在
			Tiao('/packageA/pages/wx-login/wx-login')
		}
	} else {
		//直接跳
		Tiao(url, nav)
	}
}

//跳转
function Tiao(url, nav = 0) {
	if (url, nav == 1) {
		//关闭当前页
		uni.redirectTo({
			url: url,
		})
	} else if (nav == 2) {
		//关闭所以页
		uni.reLaunch({
			url: url,
		})
	} else if (nav == 3) {
		//tabBar跳转
		uni.switchTab({
			url: url,
		})
	} else {
		//普通跳转
		uni.navigateTo({
			url: url,
		})
	}
}

//提示
function Ti(title = '', duration = 1500, mask = false, icon = "none") {
	uni.showToast({
		title: title,
		duration: duration,
		icon: icon,
		mask: mask,
	})
}

// 未来日期


export default {
	urlClick,
	Tiao,
	Ti,
}